<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui" template="/masterPage.xhtml">
	<ui:define name="content">
		<h:form id="orders_form">
			<p:toolbar id="toolbar"  style="margin-top:20px; margin-bottom:5px">
				<p:toolbarGroup align="left">
					<p:commandButton value="New Order"
						action="#{ordersBean.showDialog}" style="font-size: 85% !important" />
				</p:toolbarGroup>
			</p:toolbar>
			<p:dataTable id="OrdersTable" value="#{ordersBean.orders}"
				var="order" rowKey="#{order.id}"
				selection="#{ordersBean.selectedOrder}" selectionMode="single">
				<p:column id="order_id" headerText="ID" sortBy="#{order.id}">
					<h:outputText value="#{order.id}" />
				</p:column>
				<p:column id="order_bookName" headerText="Book's name">
					<h:outputText value="#{order.bookName}" />
				</p:column>
				<p:column id="order_bookUrl" headerText="Book's URL">
					<h:outputText value="#{order.bookUrl}" />
				</p:column>
				<p:column id="order_user" headerText="User">
					<h:outputText value="#{order.users.firstName} #{order.users.lastName}" />
				</p:column>
				<p:column id="order_shop" headerText="Shop">
					<h:outputText value="#{order.shops.name}" />
				</p:column>
				<p:column id="order_status" headerText="Status">
					<h:outputText value="#{order.orderStatuses.name}" />
				</p:column>
				<p:column id="order_notes" headerText="Notes">
					<h:outputText value="#{order.notes}" />
				</p:column>
			</p:dataTable>
		</h:form>
		<h:form id="newOrder_form">
			<p:dialog id="newOrderDialog" header="New Order"
				widgetVar="newOrderDialog" modal="true">
				<ui:include src="dialogs/newOrderDialog.xhtml" />
			</p:dialog>
		</h:form>
	</ui:define>
</ui:composition>